<template>
  <a-card :bordered="false" class="card-area">

    <div class='table-operator'>
      <a-button @click='handleAdd' type='primary' icon='plus'>新增签约医生</a-button>
    </div>

    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
         <span slot='action' slot-scope='text, record'>
             <a-popconfirm title='确定解除绑定吗?' @confirm='() => handleDelete(record.id)'>
                <a>解除绑定</a>
             </a-popconfirm>
        </span>

      </a-table>
    </div>
    <HPatientDoctorModal ref='modalForm' @ok='modalFormOk' :patientId="patientId"></HPatientDoctorModal>
  </a-card>
</template>

<script>
import { httpAction, putAction, getAction, postAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'

import HPatientDoctorModal from './HPatientDoctorModal'
export default {
  name: '签约医生',
  mixins: [JeecgListMixin],
  components: {
    HPatientDoctorModal
  },
  props: {
     patientId: Number,
  },
  watch: {
    patientId(newValue) {
      this.getPatient(newValue);
    }
  },
  data() {
    return {
      queryParam: {
        patientId: 0
      },
      confirmLoading: false,
      disableMixinCreated: true,
      validatorRules: {},
      // 表头
      columns: [
        {
          title: '医生名称',
          align: 'center',
          dataIndex: 'doctorName'
        },
        {
          title: '状态',
          align: 'center',
          dataIndex: 'status',
          customRender: function(t, r, index) {
            return t=='0'?"无效":"有效";
          }
        },
        {
          title: '签药时间',
          align: 'center',
          dataIndex: 'createTime'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: '/ch/patient/doctor/list',
        delete: '/ch/patient/doctor',
        deleteBatch: '/system/hisSupplier/deleteBatch'
      },
      patientId:0,
    }
  },
  created() {
  },
  methods: {
    getPatient(patientId){
      this.queryParam.patientId = patientId
      this.patientId=patientId;
      this.loadData()
    },
  }
}
</script>

<style scoped>

</style>